import './assets/main.scss'
import './assets/font/iconfont.css'
import router from './router'
import { createPinia } from 'pinia'
//pinia数据持久化存储
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'
import { createApp } from 'vue'
//rem大小随屏幕高度变化
import './assets/js/setRemByclientHeight.js'

import 'element-plus/dist/index.css'
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import App from './App.vue'
// element ui使用中文版本
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import directives from './directive'
import { http } from './utils/index.js'
// 权限
import './permission'

const pinia = createPinia()
pinia.use(piniaPluginPersistedstate)

const app = createApp(App)
for (const key in directives) {
  app.directive(key, directives[key])
}
app.config.globalProperties.http = http
app.use(ElementPlus, {
  locale: zhCn
})
//注册el-icon图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
app.use(pinia)
app.use(router)

// app.use(store)
app.mount('#app')
